package com.android.util;


import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.TextView;

import com.android.R;


/**
 * author mj
 */
class SimplePromptDialog extends Dialog
{

	public SimplePromptDialog(Context context, int theme)
	{
		super(context, theme);
	}

	public static SimplePromptDialog createDialog(Context context)
	{
		SimplePromptDialog dialog = new SimplePromptDialog(context, R.style.SimpleHUD);
		dialog.setContentView(R.layout.view_simplehud);
		dialog.getWindow().getAttributes().gravity = Gravity.CENTER;

		return dialog;
	}

	public void setMessage(String message)
	{
		TextView msgView = (TextView) findViewById(R.id.simplehud_message);
		msgView.setText(message);

	}
    
	public void setImage(Context ctx, int resId)
	{
		ImageView image = (ImageView) findViewById(R.id.simplehud_image);
		image.setImageResource(resId);
        
		if (resId == R.mipmap.simplehud_spinner)
		{
			Animation anim = AnimationUtils.loadAnimation(ctx, R.anim.hud_progressbar);
			anim.start();
			image.startAnimation(anim);
		}
	}

}
